﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WEBDT.Base;
using WEBDT.ViewModel;
namespace WEBDT.Areas.Front.Controllers
{
    public class DienThoaiController : BaseController<SanPham>
    {
        //
        // GET: /Front/Product/

        public ActionResult Index()
        {
            return View();
        }
        public override ActionResult getAll()
        {
            return View(repository.ListDT());
        }
        [HttpGet]
        public override ActionResult Details(int id)
        {
            var ht = repository.SelectByID<SanPham>(id);
            string mota = ht.Mota;
            var arr = mota.Split('*');
            var model = new DienThoaiModel
            {
                MaSP = ht.MaSP,
                TenSP = ht.TenSP,
                DanhGia = ht.DanhGia,
                LinkImage = ht.LinkImage,
                MaLoai = ht.MaLoai,
                MaNSX = ht.MaNSX,
                DonGia = ht.DonGia,
                SoLuong = ht.SoLuong,
                LuotXem = ht.LuotXem,
                Status = ht.Status,
                Selloff = ht.Selloff,
                TimeBH = ht.TimeBH,
                Mayanh = arr[0],
                quayphim = arr[1],
                nghenhac = arr[2],
                xemphim = arr[3],
                trochoi = arr[4],
                loangoai = arr[5],
                ghiam = arr[6],
                ungdungvp = arr[7],
                loainhacchuong = arr[8],
                tainhac = arr[9],
                bonhotrong = arr[10],
                thenhongoai = arr[11],
                danhbadt = arr[12],
                tinnhan = arr[13],
                GPRS = arr[14],
                bag = arr[15],
                wifi = arr[16],
                gps = arr[17],
                loaimh = arr[18],
                kichthuocmh = arr[19],
                camung = arr[20],
                loaipin = arr[21],
                thoigiancho = arr[22],
                thoigianthoai = arr[23],
                kichthuocmay = arr[24],
                trongluong = arr[25],
                hedieuhanh = arr[26],
            };
            return View(model);
        }

    }
}
